//
//  QDailyAPI.h
//  FakeQDaily
//
//  Created by mewxiv on 8/12/16.
//  Copyright © 2016 Xensius. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "FQDMultipartFileData.h"

typedef NS_ENUM(NSInteger, QDailyPersonalInfoType) {
    QDailyPersonalInfoTypeAvatar,           // 头像
    QDailyPersonalInfoTypeUsername,         // 用户名
    QDailyPersonalInfoTypeSignature,        // 简介
    QDailyPersonalInfoTypeEmail,            // Email
    QDailyPersonalInfoTypeAddress,          // 地址
    QDailyPersonalInfoTypeMobile,           // 手机
    QDailyPersonalInfoTypeCurPassword,      // 当前密码
    QDailyPersonalInfoTypePassword,         // 密码
    QDailyPersonalInfoTypeConfirmPass,      // 确认密码
    QDailyPersonalInfoTypeStatus,           // 状态，用处暂未知
    QDailyPersonalInfoTypeSource,           // 应用下载源（如AppStore）
};

typedef void (^QDailyAPICompleteBlock)(id responseObject, NSError *error);

@interface QDailyAPI : NSObject

// 好奇心日报API管理器单例
+ (instancetype)sharedAPI;
// 向好奇心日报API发送Get请求获取json
- (void)getJson:(NSString *)endpoint parameters:(id)parameters completion:(QDailyAPICompleteBlock)completion;
// 向好奇心日报API发送Get请求
- (void)get:(NSString *)endpoint parameters:(id)parameters completion:(QDailyAPICompleteBlock)completion;
// 向好奇心日报API发送Post请求
- (void)post:(NSString *)endpoint parameters:(id)parameters completion:(QDailyAPICompleteBlock)completion;
// 向好奇心日报API发送Post请求，上传表单数据
- (void)post:(NSString *)endpoint parameters:(id)parameters bodyFormData:(NSDictionary *)bodyFormData completion:(QDailyAPICompleteBlock)completion;
// 向好奇心日报API发送Post请求，上传表单数据和文件
- (void)post:(NSString *)endpoint parameters:(id)parameters bodyFormData:(NSDictionary *)bodyFormData partFileDatas:(NSDictionary *)partFileDatas completion:(QDailyAPICompleteBlock)completion;
//  向好奇心日报API发送Put请求
- (void)put:(NSString *)endpoint parameters:(id)parameters completion:(QDailyAPICompleteBlock)completion;
//  向好奇心日报API发送Delete请求
- (void)delete:(NSString *)endpoint parameters:(id)parameters completion:(QDailyAPICompleteBlock)completion;


/*
 * 注册登录
 */
// 邮箱注册账号
- (void)registerWithEmail:(NSString *)email password:(NSString *)password completion:(QDailyAPICompleteBlock)completion;
// 完善邮箱注册信息
- (void)completeRegisterWithEmail:(NSString *)email password:(NSString *)password
                         username:(NSString *)username signature:(NSString *)signature
               avatarPartFileData:(FQDMultipartFileData *)avatarPartFileData
                       completion:(QDailyAPICompleteBlock)completion;
// 手机号码登录
- (void)loginWithPhone:(NSString *)phone password:(NSString *)password remember:(BOOL)remember completion:(QDailyAPICompleteBlock)completion;
// email账户登录
- (void)loginWithEmail:(NSString *)email password:(NSString *)password remember:(BOOL)remember completion:(QDailyAPICompleteBlock)completion;
// 注销登录
- (void)logout:(QDailyAPICompleteBlock)completion;
// 修改用户密码
- (void)changePassword:(NSString *)currentPass newPassword:(NSString *)password completion:(QDailyAPICompleteBlock)completion;
// 更新用户信息（不包括头像），数据以NSString格式封装
- (void)updatePersonalInfo:(QDailyPersonalInfoType)infoType infoValue:(NSString *)infoValue completion:(QDailyAPICompleteBlock)completion;
// 上传并更新用户头像
- (void)updateAvatarWithPartFileData:(FQDMultipartFileData *)partFileData completion:(QDailyAPICompleteBlock)completion;

/*
 * 获取用户订阅信息
 */
// 请求用户雷达
- (void)getUserRadar:(QDailyAPICompleteBlock)completion;
// 请求用户订阅
- (void)getUserSubscription:(NSString *)userId completion:(QDailyAPICompleteBlock)completion;
// 请求用户中心
- (void)getUserCenter:(QDailyAPICompleteBlock)completion;
// 请求订阅栏目
- (void)addSubscribeColumn:(NSString *)columnId completion:(QDailyAPICompleteBlock)completion;
// 请求取消订阅栏目
- (void)removeSubscribeColumn:(NSString *)columnId completion:(QDailyAPICompleteBlock)completion;

/* 
 * 主页
 */
// 获取主页feed
- (void)getHomeFeed:(NSString *)key completion:(QDailyAPICompleteBlock)completion;

/*
 * 侧边栏
 */
// 获取主页菜单栏的数据
- (void)getSideBar:(QDailyAPICompleteBlock)completion;
// 获取新闻分类的数据
- (void)getNewsCategoriesFeed:(NSString *)categoryId key:(NSString *)key completion:(QDailyAPICompleteBlock)completion;
// 搜索文章的接口
- (void)searchArticle:(NSString *)keyword key:(NSString *)key completion:(QDailyAPICompleteBlock)completion;

/*
 * 栏目中心
 */
// 获取栏目信息流数据的接口
- (void)getColumnFeed:(NSString *)columnId key:(NSString *)key completion:(QDailyAPICompleteBlock)completion;
// 获取栏目中心里我的订阅文章数据
- (void)getColumnSubscriptionPosts:(NSString *)key completion:(QDailyAPICompleteBlock)completion;
// 获取栏目中心里所有栏目的数据
- (void)getAllColumnsInColumnCenter:(NSString *)key completion:(QDailyAPICompleteBlock)completion;
// 请求栏目作者订阅者信息
- (void)getColumnAuthorsAndSubscribersInfo:(NSString *)columnId completion:(QDailyAPICompleteBlock)completion;

/*
 * 文章
 */
// 请求文章页面数据
- (void)getArticleDetail:(NSString *)postId completion:(QDailyAPICompleteBlock)completion;
// 请求文章信息数据
- (void)getArticleInfo:(NSString *)postId completion:(QDailyAPICompleteBlock)completion;
// 获取文章评论数据
- (void)getArticleComments:(NSString *)postId key:(NSString *)key completion:(QDailyAPICompleteBlock)completion;
// 请求评论文章
- (void)commentArticle:(NSString *)postId content:(NSString *)content parentCommentId:(NSString *)parentCommentId completion:(QDailyAPICompleteBlock)completion;
// 点赞文章
- (void)praisePost:(NSString *)postId genre:(NSInteger)genre praiseType:(NSString *)praiseType completion:(QDailyAPICompleteBlock)complete;
// 获取标签文章列表
- (void)getTaggedArticleList:(NSString *)tagId key:(NSString *)key completion:(QDailyAPICompleteBlock)completion;

/*
 * 好奇心研究所
 */
// 获取好奇心研究所文章列表
- (void)getLabPaperList:(NSString *)key completion:(QDailyAPICompleteBlock)completion;
// 获取好奇心研究所文章详情
- (void)getLabPaperDetail:(NSString *)postId completion:(QDailyAPICompleteBlock)completion;
// 获取好奇心研究所文章的意见选项
- (void)getLabOptions:(NSString *)postId key:(NSString *)key completion:(QDailyAPICompleteBlock)completion;
// 发送好奇心研究所投票结果
- (void)sendLabVoteResultWithOptionIds:(NSArray *)optionIds paperId:(NSString *)paperId completion:(QDailyAPICompleteBlock)completion;

/*
 * 我的消息
 */
// 获取我的评论消息接口
- (void)getMyCommentMessages:(NSString *)key completion:(QDailyAPICompleteBlock)completion;
// 获取点赞的消息接口
- (void)getMyPraiseMessages:(NSString *)key completion:(QDailyAPICompleteBlock)completion;
// 获取系统消息的接口
- (void)getMySystemMessages:(NSString *)key completion:(QDailyAPICompleteBlock)completion;
// 获取我发出的评论的接口
- (void)getMySendOutComments:(NSString *)key completion:(QDailyAPICompleteBlock)completion;

/*
 * 个人中心
 */
// 请求喜欢的文章列表
- (void)getUserPraisedArticleList:(NSString *)key completion:(QDailyAPICompleteBlock)completion;
// 请求参与的研究列表
- (void)getUserJoinedLabResearchList:(NSString *)key completion:(QDailyAPICompleteBlock)completion;
// 请求用户雷达的文章列表
- (void)getUserRadarArticleList:(NSString *)radarId key:(NSString *)key completion:(QDailyAPICompleteBlock)completion;

@end
